﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Dept_Create.aspx.cs" Inherits="SYS_POPEDOM_Dept_Create" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript" src="../JavaScript/Common.js"></script>

    <link href="../css/PageStyle.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        function SaveDept() {
            Ext.net.DirectMethods.SaveDept({ success: function (result) { ResultHandle(result); } });
        }

        function ResultHandle(result) {
            if (result == "true") {
                parent.TreePanel1.getSelectionModel().getSelectedNode().reload();
                Closepopwin();
            }
        }
        function Cancel() {
            Closepopwin();
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server" AjaxViewStateMode="Enabled" />
            <ext:Viewport ID="Viewport1" runat="server">
                <Content>
                    <ext:FitLayout ID="FitLayout1" runat="server">
                        <Items>
                            <ext:Panel ID="Panel1" runat="server" ButtonAlign="Center" BodyStyle="padding:10px;border-width:0 0 1 0;">
                                <LoadMask AutoDataBind="true" ShowMask="true" Msg="加载中..." />
                                <Content>
                                    <ext:Panel ID="pp" runat="server" Border="false" Layout="FitLayout">
                                        <Content>
                                            <ext:FormLayout ID="FormLayout1" runat="server">
                                                <Anchors>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:TextField ID="txtDeptNo" runat="server" FieldLabel="部门编号" LabelStyle=" text-align:right; "
                                                            AllowBlank="false">
                                                        </ext:TextField>
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:TextField ID="txtDeptName" runat="server" FieldLabel="部门名称" LabelStyle=" text-align:right; "
                                                            AllowBlank="false">
                                                            <DirectEvents>
                                                                <Blur OnEvent="GetPY" />
                                                            </DirectEvents>
                                                        </ext:TextField>
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:TextField ID="txtDeptPym" runat="server" FieldLabel="拼音码" LabelStyle=" text-align:right; "
                                                            AllowBlank="false">
                                                        </ext:TextField>
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:CompositeField ID="CompositeField1" runat="server" FieldLabel="条码代码" LabelStyle=" text-align:right; " Visible="false" >
                                                            <Items>
                                                                <ext:TextField ID="txtInnerDept_No" MaxLength="3" MinLength="3" MaxLengthText="条码代码应为3位" MinLengthText="条码代码应为3位" runat="server" AllowBlank="false" Flex="1">
                                                                    <Listeners>
                                                                        <Blur Handler="var val = item.getValue();if(val.length==1)val ='00'+val;else if(val.length==2)val ='0'+val;txtInnerDept_No.setValue(val); " />
                                                                    </Listeners>
                                                                </ext:TextField>
                                                                <ext:Button ID="Button1" runat="server" Text="获取新条码" OnClientClick="Ext.net.DirectMethods.GetNewInnerDept_No();" />
                                                            </Items>
                                                        </ext:CompositeField>
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:ComboBox ID="cmbDeptType" runat="server" FieldLabel="部门类型" LabelStyle=" text-align:right; "
                                                            SelectedIndex="0" Editable="false">
                                                        </ext:ComboBox>
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:TextField ID="txtDeptParent" runat="server" FieldLabel="上级部门" LabelStyle=" text-align:right; "
                                                            ReadOnly="true">
                                                        </ext:TextField>
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="95%">
                                                        <ext:ComboBox ID="extcomb_Manager" runat="server" ValueField="USER_ID"
                                                            DisplayField="USER_NAME" TypeAhead="true" Mode="Local" ForceSelection="true"
                                                            Hidden="true" TriggerAction="All" FieldLabel="主管" LabelStyle=" text-align:right; ">
                                                            <Store>
                                                                <ext:Store ID="Store1" runat="server" AutoLoad="true">
                                                                    <Reader>
                                                                        <ext:JsonReader IDProperty="USER_ID">
                                                                            <Fields>
                                                                                <ext:RecordField Name="USER_ID" />
                                                                                <ext:RecordField Name="USER_NAME" />
                                                                            </Fields>
                                                                        </ext:JsonReader>
                                                                    </Reader>
                                                                </ext:Store>
                                                            </Store>
                                                        </ext:ComboBox>
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="50%">
                                                        <ext:RadioGroup ID="RadioGroup1" runat="server" FieldLabel="虚部门" LabelStyle=" text-align:right; " Visible="false" >
                                                            <Items>
                                                                <ext:Radio ID="rdoDeptVirtual1" runat="server" BoxLabel="是">
                                                                </ext:Radio>
                                                                <ext:Radio ID="rdoDeptVirtual2" runat="server" BoxLabel="否" Checked="true">
                                                                </ext:Radio>
                                                            </Items>
                                                        </ext:RadioGroup>
                                                    </ext:Anchor>
                                                    <ext:Anchor Horizontal="50%">
                                                        <ext:TextField ID="exttxtf_AREA" runat="server" FieldLabel="部门位置" LabelStyle=" text-align:right; " AllowBlank="true"  Visible="false" >
                                                        </ext:TextField>
                                                    </ext:Anchor>
                                                </Anchors>
                                            </ext:FormLayout>
                                        </Content>
                                    </ext:Panel>
                                </Content>
                                <Buttons>
                                    <ext:Button runat="server" ID="btnSave" Text="确定" Icon="Accept">
                                        <Listeners>
                                            <Click Fn="SaveDept" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:Button runat="server" ID="btnCancel" Text="取消" Icon="Cancel">
                                        <Listeners>
                                            <Click Fn="Cancel" />
                                        </Listeners>
                                    </ext:Button>
                                </Buttons>
                            </ext:Panel>
                        </Items>
                    </ext:FitLayout>
                </Content>
            </ext:Viewport>
        </div>
    </form>
</body>
</html>
